<template>
    <view class="wallet-wrapper">
        <view class="money common-interval common-flex-between">
            <view>
                <text class="account">账户余额</text>
                <view style="margin-top: 32rpx;">
                    <text style="font-size: 24rpx;">¥</text>
                    <text class="amount">{{money.balance}}</text>
                </view>
            </view>
            <view class="cash-btn" @tap.stop="withdraw">提现</view>
        </view>
        <view class="money-info common-interval common-flex-between"  @tap="myDeposit">
            <text>我的押金</text>
            <view class="common-little-font">
                <text>押金{{money.totalDeposit}}元</text>
                <text class="icon-arrow-right"/>
            </view>
        </view>
        <view class="money-info common-interval common-flex-between" @tap="watchAccount">
            <text>账户明细</text>
            <text class="icon-arrow-right common-little-font"/>
        </view>
    </view>
</template>

<script>
    import service from "@/service";
    export default {
        name: "wallet",
        data(){
            return{
                money: {}
            }
        },
        onShow(){
            this.getMoney();
        },
        methods: {
            withdraw(){
                uni.navigateTo({
                    url: './withdraw'
                })
            },
            watchAccount(){
                uni.navigateTo({
                    url: './account-detail'
                })
            },
            myDeposit(){
                uni.navigateTo({
                    url: '../vip/vip-center?noTable=1&type=4'
                })
            },
            getMoney(){
                uni.showLoading({
                    title: '',
                });
                service.mineService.getMoney({
                    data: {},
                    success: res => {
                        uni.hideLoading();
                        if (res.code === 200) {
                            console.log(res, 'res');
                            this.money = res.result || {}
                        } else {
                            uni.showToast({
                                title: `${res.resultMsg}`,
                                duration: 2500,
                                icon: 'none'
                            });
                        }
                    },
                    fail: ()=>{
                        uni.hideLoading();
                    },
                    complete: () => {
                    },
                });
            },
        }
    }
</script>

<style scoped lang="scss">
    .wallet-wrapper{
        min-height: 100%;
        background: #F9F9F9;
        .money{
            height: 262rpx;
            background: #2BA8FC;
            color: #fff;
            align-items: center;
            margin-bottom: 20rpx;
            .account{
                font-size: 32rpx;
            }
            .amount{
                font-size: 58rpx;
                margin-left: 15rpx;
            }
        }
        .cash-btn{
            width:222rpx;
            height:68rpx;
            line-height: 68rpx;
            color: #2BA8FC;
            font-size: 32rpx;
            border-radius: 38rpx;
            background: #ffffff;
            text-align: center;
        }
        .money-info{
            border-bottom: 1rpx solid #F9F9F9;
            height: 118rpx;
            align-items: center;
        }
    }
</style>